<!DOCTYPE html>
<html lang="en">
  <head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="icon" type="image/svg+xml" href="img/elk_fav.svg">

    
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <link rel="stylesheet" href="https://www.eclipse.org/elk/css/elk.css">
    <link rel="stylesheet" href="https://www.eclipse.org/elk/css/prism.css">

    <title>ELK Text Format (ELK)</title>

    
    
  </head>
  <body>

<nav class="navbar navbar-expand-lg navbar-dark">
  <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://www.eclipse.org/elk/">
    <img src="img/elk_small_light.svg" height="30" class="d-inline-block align-top mr-1" alt="">
    Eclipse Layout Kernel&trade;
  </a>
  <div class="collapse navbar-collapse" id="navbarCollapse">
    <ul class="navbar-nav mr-auto">

      
      
        
        <li class="nav-item">
          <a class="nav-link" href="../../../downloads.html">Downloads</a>
        </li>
      
        
        <li class="nav-item">
          <a class="nav-link" href="../../../gettingstarted.html">Getting Started</a>
        </li>
      
        
        <li class="nav-item active">
          <a class="nav-link" href="../../../documentation.html">Documentation <span class="sr-only">(current)</span></a>
        </li>
      
        
        <li class="nav-item">
          <a class="nav-link" href="../../../reference.html">Reference</a>
        </li>
      
        
        <li class="nav-item">
          <a class="nav-link" href="../../../support.html">Support</a>
        </li>
      
        
        <li class="nav-item">
          <a class="nav-link" href="../../../blog.html">Blog Posts</a>
        </li>
      

      <li class="nav-item">
        <a class="nav-link" href="https://github.com/eclipse-elk/elk">GitHub</a>
      </li>

    </ul>
  </div>
</nav>


<div class="container px-3 py-5">


<div class="row">
  <div class="col-sm-9">
    <h1>ELK Text Format</h1>

    <p>The ELK text format has five basic elements: nodes, ports, labels, edges and edge sections.
Details about each element can be found below.
Note that the ELK text format uses default node sizes if they are not specified to make writing elkt files more convenient.
This is different from the JSON format, where no such defaults are assumed.</p>
<h2 id="nodes-ports-labels-edges-and-edge-sections">Nodes, Ports, Labels, Edges, and Edge Sections</h2>
<p>Nodes and ports must have an <em>id</em> that uniquely identifies them.
Labels are usually not referred to from other parts of the graph, which is why the id is optional.
The id is a string that has to begin with a letter.
All elements furthermore can have <a href="../../../reference/options.html"><em>layout options</em></a>.
Layout options are basically a list of key-value pairs that are used to assign layout option values to the element.
Layout options can be an enum value, an enum set, an integer, a double, or other more complex objects.
For each layout option the type is specified in the <a href="../../../reference/options.html"><em>reference</em></a>.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">layoutOption1: ENUM_VALUE
layoutOption2: &#34;ENUM_VALUE_1 ENUM_VALUE_2&#34;
layoutOption3: 10.0
</code></pre><p>A special case is <a href="../../../reference/options/org-eclipse-elk-padding.html"><em>padding</em></a>.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">padding: &#34;[top=20.0,left=20.0,bottom=20.0,right=20.0]&#34;
</code></pre><p><a href="../../../reference/options/org-eclipse-elk-spacing-individual.html"><em>Individual spacings</em></a> are essentially a map of options that use a special syntax.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">spacing.individual: &#34;spacing.nodeNode: 10.0 :: spacing portsSurrounding: [top=40.0,left=10.0,bottom=10.0,right=30.0]&#34;
</code></pre><h2 id="nodes-ports-and-labels">Nodes, Ports, and Labels</h2>
<p>Nodes, ports, and labels have a two-dimensional location and size.
Each of these elements can also have an arbitrary number of labels to describe them properly.
Yes, even labels can have labels, although it depends on the layout algorithm whether or not it supports labeled labels.
The optional <code>layout</code> block may be used to specify the size and positions of these elements.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">layout [
  position: x, y
  size: w, h
] 
</code></pre><h2 id="nodes">Nodes</h2>
<p>Nodes can have an arbitrary number of ports.
Edges can connect to a node either directly or through one of its ports.
A node can also contain an arbitrary number of child nodes.
A graph is actually nothing more than a simple node whose children are the top-level nodes of the graph.
Finally, a node can contain edges.
While it is common to define those edges under a given node that connect that node&rsquo;s children, in fact any edge may be defined under any node, regardless of its end points.
This allows for flexibility when defining hierarchy-crossing edges, as well as for alternative schemes, such as defining all edges at the root level.
Note that this is not recommended and in some cases poorly supported.
See <a href="../../../documentation/tooldevelopers/graphdatastructure/coordinatesystem.html"><em>Coordinate System</em></a> for the rules for interpreting edge coordinates.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">node n {
  layout [
    position: x, y
    size: w, h
  ]
  // list of layout options
  
  // definitions of any contained labels, ports, edges and other nodes
}
</code></pre><h2 id="ports">Ports</h2>
<p>Ports do not have any more interesting properties. Ports are boring.</p>
<h2 id="labels">Labels</h2>
<p>Labels contain text.
Note that layout algorithms generally don&rsquo;t perform any size estimation of the text.
Therefore you should specify a reasonable width and height.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">label &#34;A magnificent text&#34;
</code></pre><h2 id="edges">Edges</h2>
<p>There are two types of edges: primitive edges and extended edges.
Primitive edges are solely supported for legacy models to work.
Exported graphs will always be made up of extended edges.
Both kind of edges support labels.</p>
<h3 id="primitive-edges">Primitive Edges</h3>
<p>Primitive edges have a source and target node and can optionally connect to a source port and target port.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">edge source_node_id.source_port_id -&gt; target_node_id.target_port_id {
  layout [
    start: x, y
    bends: x, y | x, y | x, y
    end: x, y
  ],
  // any attached labels
}
</code></pre><h3 id="extended-edges">Extended Edges</h3>
<p>Extended edges have two mandatory arrays consisting of the identifiers of nodes and ports.
One array defines the edge&rsquo;s source elements, the other defines its target elements.
Edges may well connect more than one source to more than one target, making them hyperedges.
It should be noted that currently none of the algorithms implemented in ELK explicitly support hyperedges.
Note that many layout algorithms don&rsquo;t support hyperedges.
If an edge has a layout, it can specify an arbitrary number of edge sections
that define said layout.
A simple edge with one source and one target only needs a single section.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">edge source_node_id.source_port_id, another_source -&gt; target_node_id.target_port_id, another_target {
  layout [
    // list of edge sections
  ],
  // any attached labels
}
</code></pre><h2 id="edge-sections">Edge Sections</h2>
<p>Edge sections are only used in conjunction with extended edges and capture the routing of an edge through a drawing.
Each section connects two end points.
An end point can be one of the end points of the section&rsquo;s edge (a node or a port), or one or more other edge sections.
The points where edge sections meet are <em>junction points</em> where one part of the edge branches off.
An edge section can only have either an incoming shape or incoming edge sections (the same is true of course for outgoing shapes and outgoing edge sections).
In the simplest case, an edge only has a single edge section which runs from the edge&rsquo;s single source to its single target.
In this case, it is enough to define the section&rsquo;s start and end point and possibly bendpoints.
Incoming and outgoing shapes are then filled in automatically by the importer.
Specifying edge sections in the elkt format is unnecessary in all normal use cases, because the layout algorithms will create them where necessary.</p>
<pre tabindex="0"><code class="language-elkt" data-lang="elkt">section incoming_sections -&gt; outgoing_sections [
  start: x, y
  end: x, y
  bends: x, y | x, y | x, y
  incoming: node and / or port identifier
  outgoing: node and / or port identifier
]
</code></pre><h2 id="examples">Examples</h2>
<p>Many examples can be found in <a href="https://rtsys.informatik.uni-kiel.de/elklive/examples.html"><em>elklive</em></a>.</p>

  </div>

  <div class="secnav col-sm-3">
  <ul>
    
    
      
    
      
    
      
        




  
  <a href="../../../documentation/tooldevelopers.html">
    <li class="navlevel-1">
      Tool Developers
    </li>
  </a>
  
    
    




  
  <a href="../../../documentation/tooldevelopers/graphdatastructure.html">
    <li class="navlevel-2">
      Graph Data Structure
    </li>
  </a>
  
    
    




  
  <a href="../../../documentation/tooldevelopers/graphdatastructure/coordinatesystem.html">
    <li class="navlevel-3">
      Coordinate System
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/graphdatastructure/layoutoptions.html">
    <li class="navlevel-3">
      Layout Options
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/graphdatastructure/spacingdocumentation.html">
    <li class="navlevel-3">
      Spacing Options
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/graphdatastructure/jsonformat.html">
    <li class="navlevel-3">
      JSON Format
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/graphdatastructure/elktextformat.html">
    <li class="navlevel-3 active">
      ELK Text Format
    </li>
  </a>
  


  

  
  <a href="../../../documentation/tooldevelopers/usingalgorithmsdirectly.html">
    <li class="navlevel-2">
      Using Algorithms Directly
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/usingplainjavalayout.html">
    <li class="navlevel-2">
      Using Plain Java Layout
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/usingeclipselayout.html">
    <li class="navlevel-2">
      Using Eclipse Layout
    </li>
  </a>
  
    
    




  
  <a href="../../../documentation/tooldevelopers/usingeclipselayout/connectingtoelk.html">
    <li class="navlevel-3">
      Connecting to ELK
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/usingeclipselayout/advancedconfiguration.html">
    <li class="navlevel-3">
      Advanced Configuration
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/usingeclipselayout/layoutviewsupport.html">
    <li class="navlevel-3">
      Layout View Support
    </li>
  </a>
  

  
  <a href="../../../documentation/tooldevelopers/usingeclipselayout/dependencyinjection.html">
    <li class="navlevel-3">
      Dependency Injection
    </li>
  </a>
  


  


  

  
  <a href="../../../documentation/algorithmdevelopers.html">
    <li class="navlevel-1">
      Algorithm Developers
    </li>
  </a>
  
    
    




  
  <a href="../../../documentation/algorithmdevelopers/gettingeclipseready.html">
    <li class="navlevel-2">
      Getting Eclipse Ready
    </li>
  </a>
  

  
  <a href="../../../documentation/algorithmdevelopers/creatinganewproject.html">
    <li class="navlevel-2">
      Creating a New Project
    </li>
  </a>
  

  
  <a href="../../../documentation/algorithmdevelopers/metadatalanguage.html">
    <li class="navlevel-2">
      ELK Metadata Language
    </li>
  </a>
  
    
    




  
  <a href="../../../documentation/algorithmdevelopers/metadatalanguage/automaticbuilds.html">
    <li class="navlevel-3">
      Automatic Builds
    </li>
  </a>
  


  

  
  <a href="../../../documentation/algorithmdevelopers/algorithmimplementation.html">
    <li class="navlevel-2">
      Algorithm Implementation
    </li>
  </a>
  
    
    




  
  <a href="../../../documentation/algorithmdevelopers/algorithmimplementation/algorithmstructure.html">
    <li class="navlevel-3">
      Structuring Algorithms
    </li>
  </a>
  


  

  
  <a href="../../../documentation/algorithmdevelopers/algorithmdebugging.html">
    <li class="navlevel-2">
      Algorithm Debugging
    </li>
  </a>
  

  
  <a href="../../../documentation/algorithmdevelopers/randomgraphs.html">
    <li class="navlevel-2">
      Random Graph Generation
    </li>
  </a>
  

  
  <a href="../../../documentation/algorithmdevelopers/unittesting.html">
    <li class="navlevel-2">
      Unit Tests
    </li>
  </a>
  


  

  
  <a href="../../../documentation/contributors.html">
    <li class="navlevel-1">
      ELK Contributors
    </li>
  </a>
  
    
    




  
  <a href="../../../documentation/contributors/developmentsetup.html">
    <li class="navlevel-2">
      Development Setup
    </li>
  </a>
  

  
  <a href="../../../documentation/contributors/developmentworkflow.html">
    <li class="navlevel-2">
      Development Workflow
    </li>
  </a>
  
    
    




  
  <a href="../../../documentation/contributors/developmentworkflow/installingwithoomph.html">
    <li class="navlevel-3">
      Installing With Oomph
    </li>
  </a>
  


  

  
  <a href="../../../documentation/contributors/buildingelk.html">
    <li class="navlevel-2">
      Building ELK
    </li>
  </a>
  


  


      
    
      
    
      
    
      
    
  </ul>

  <div class="incubation-egg">
    <a href="https://www.eclipse.org/projects/what-is-incubation.php">
      <img src="https://www.eclipse.org/images/egg-incubation.png" alt="Incubation" />
    </a>
  </div>
</div>

</div>

    </div>
    <footer role="contentinfo" class="footer">
      <div class="container">
        <div class="row">
            <div class="col">
              <span class="hidden-print">
                <a href="https://www.eclipse.org"><img class="logo-eclipse-white img-responsive" alt="logo" src="../../../img/eclipse_foundation_logo.svg"/></a>
              </span>
            </div>
            <div class="col">
              
            </div>
          </div>
        <div class="row">
          <div class="col hidden-print">
            <a href="http://www.eclipse.org/">Eclipse Foundation</a><br/>
            <a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a><br/>
            <a href="http://www.eclipse.org/legal/termsofuse.php">Website Terms of Use</a><br/>
            <a href="http://www.eclipse.org/legal/copyright.php">Copyright Agent</a><br/>
            <a href="http://www.eclipse.org/legal">Legal</a>
          </div>
          <div class="col">
              <p class="copyright-text">Copyright &copy; Eclipse Foundation, Inc. All Rights Reserved.</p>
          </div>
        </div>
      </div>

    </footer>

    <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
    <script src="https://www.eclipse.org/elk/js/prism.js"></script>

    
    <script>$(function() { $('table').addClass('table'); })</script>
  </body>
</html>
